<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core" xmlns:openiot="http://openiot.org/tags" xmlns:c="http://java.sun.com/jsp/jstl/core">

<head />
<body>
	<ui:composition template="/WEB-INF/templates/main.xhtml">
		<ui:define name="title">Sign Up</ui:define>
		<ui:define name="nav-links">
			<li><a href="home.jsf">Home</a></li>
			<openiot:hasAnyRoles name="admin, user-manager">
				<li><a href="roles.jsf">Manage roles</a></li>
				<li><a href="users.jsf">Manage users</a></li>
				<li><a href="perms.jsf">Manage permissions</a></li>
			</openiot:hasAnyRoles>
		</ui:define>
		<ui:define name="content">
			<h:form id="signupForm" styleClass="input-form">
				<h:panelGrid columns="2" border="0">
					<p:panel header="Sign Up" id="panel">
						<p:messages id="messages" showDetail="true" showSummary="false" autoUpdate="true" />
						<h:panelGrid columns="2">
							<p:outputLabel value="Full Name" for="fullname" />
							<p:inputText id="fullname" label="Full Name" value="#{signupController.user.name}" required="true" />
							<p:outputLabel value="Email Address" for="email" />
							<p:inputText id="email" label="Email Address" value="#{signupController.user.email}" required="true" />
							<p:outputLabel value="Username" for="username" />
							<p:inputText id="username" label="Username" value="#{signupController.user.username}" required="true" />
							<p:outputLabel value="Password" for="password" />
							<p:password id="password" label="Password" value="#{signupController.user.password}" feedback="true" required="true" match="password2" />
							<p:outputLabel value="Confirm" for="password2" />
							<p:password id="password2" label="Password" value="#{signupController.user.password}" feedback="false" required="true" />
							<c:if test="#{signupController.automaticServiceSetup}">
								<p:outputLabel value="Service URL Prefix" for="serviceURL" />
								<h:panelGroup>
									<p:inputText id="serviceURL" label="Service URL" value="#{signupController.serviceURL}" size="200"/>
									<p:button id="help" style="width: 15px; height: 15px; vertical-align: middle; margin-left: 4px" icon="ui-icon-help" />
									<p:overlayPanel for="help" showEvent="mouseover" hideEvent="mouseout" hideEffect="fade" style="width:500px">
										<p:panel>
                						If you would like your local standard OpenIoT web applications to be able to use the provided LSM server, enter the URL of your web container deployment without including the name of the module (e.g., http://localhost:8080).
            							</p:panel>
									</p:overlayPanel>
								</h:panelGroup>
							</c:if>
							<c:if test="#{signupController.useCaptcha}">
								<p:outputLabel for="captcha" value="Secret Word" />
								<p:captcha required="true" id="captcha" publicKey="6Lds7-sSAAAAABZ_jH5MMvZK6f_pAjxAP-lU5u8B" />
							</c:if>
						</h:panelGrid>
						<p:commandButton value="Sign Up" action="#{signupController.signup}" style="display:block; margin:0 auto;" ajax="false" />
					</p:panel>
				</h:panelGrid>
			</h:form>
		</ui:define>
	</ui:composition>
</body>
</html>
